<script type="text/javascript">
var paginationTotal = 1;//记录总数

$(function(){
	initData(0);
	
	$('#dateFrom,#dateTo').datepicker({
		changeMonth: true,
		changeYear: true,			 
		dateFormat: 'yy-mm-dd'
	});
	
	$("#confirmDialog").dialog({
		autoOpen:false,
		modal:true,
		show:"slide",
		buttons:{
			"<{$lang.ok}>":function(){
				$(this).dialog("close");				
			}
		}
	});
	
	$(".toEnter").keyup(function(e){
		var key = e.which;
		if(key==13){
			initData(0);
		}
	});

});

function search() {
	initData(0);
}

function loadData(page, pageSize){
    loading();
	var login_id = $("[name=login_id]").val();
	var ot_class = $("[name=ot_class]").val();
	var dateFrom = $('[name=dateFrom]').val();
    var dateTo = $('[name=dateTo]').val();

    $.ajax({
		url: "/order/statistics/list/page/" + page + "/pageSize/" + pageSize,
        async: false,
        dataType: "json",
		type:"post",
		data:{'login_id':login_id,'ot_class':ot_class,
			  'dateFrom':dateFrom,'dateTo':dateTo},
        success: function(json) {
            var list = '';
			if(json.ask){
				paginationTotal = json.total;
				$.each(json.result, function (key, val) {
                	if ((key + 1) % 2 == 1) {
                    	list += "<tr class=''>";
                    } else {
                    	list += "<tr class='even-tr'>";
                    }
                    list += "<td >" + val.login_id+ "</td>";
                    list += "<td >" + val.ot_date + "</td>";
                    list += "<td >" + val.classText + "</td>";			//<{$lang.statistical}><{$lang.type}>
                    list += "<td >" + val.ot_order_cnt + "</td>";		//<{$lang.order}><{$lang.quantity}>
                    list += "<td >" + val.ot_sku_cnt + "</td>";		//<{$lang.order}> <{$lang.sku}> 数
                    list += "<td >&nbsp;" + '' + "</td>";
                    list += "</tr>";
                });
				$("#loadData").html(list);
			}else{
				$("#loadData").html("<tr><td colspan='6' align='center'><{$lang.no_data}></td></tr>");
			}
        }
    });
}

</script>
<style type="text/css">
.myTab table td{ border:0;text-align:center;}
#iTitle div {
	display: inline-block;
    float: left;
    padding: 0 0 0 10px;
    margin-bottom: 12px;
}
.mySelect {
	height: 22px;
    border: 1px solid #CCCCCC;
}
#iTitle input {
	height: 20px;
    border: 1px solid #CCCCCC;
}
.sort{cursor:pointer;}
</style>

<div class="search_div">
    <div id="iTitle">
        <form id="seach-form" onsubmit="return false;" action="" method="post" name="seach-form">            

            <div><{$lang.op_user}>:</div>
            <div>
                <input type="login_id" name="login_id" class="myInput toEnter" />
            </div>

            <div style="padding-left:10px"><{$lang.operation}><{$lang.type}>:</div>
            <div>
                <{$lang.operation}><{$lang.type}>:<select name="ot_class">
				<option value=""><{$lang.pls}></option>
				<{foreach key=key item=item from=$otClass}>
					<option value="<{$key}>"><{$item}></option>
				<{/foreach}>
			</select>
            </div>
            <div><{$lang.time}>:</div>
            <div>
                <{$lang.from}> <input type="text" class="dateFrom" id="dateFrom" style="width:65px;" name="dateFrom" class="input-width-1" />
                <{$lang.to}>:<input type="text" class="dateTo" id="dateTo" name="dateTo" style="width:65px;" class="input-width-1" /> 
            </div>

            <div class="tDiv8">
                <input id="searchSubmit" class="myButton" type="button" onclick="search();" value="<{$lang.search}>">
            </div>
            <div class="myClear"></div>

        </form>
    </div>
</div>

<div id="message" style="clear:both;color:red;"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myTab">
    <tbody>
    <tr class="even-tr">
    	<th><{$lang.op_user}></th>
        <th><{$lang.operation}><{$lang.date}></th>
        <th><{$lang.statistical}><{$lang.type}></th>
        
        <th><{$lang.order}><{$lang.quantity}></th>
        <th><{$lang.order}><{$lang.row_count}></th>        
        <th><{$lang.operation}></th>
    </tr>
    </tbody>
    <tbody id="loadData"></tbody>
</table>
<div class="pagination"></div>

<div id="confirmDialog" title="<{$lang.system}><{$lang.msg}>">
	
</div>